package com.zy.algorithm.sort;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ZhaoYi
 * @date 2023/11/13 15:29
 */
public class SortFactory {
    private static final Map<String, ISort> map = new HashMap<>();


    static {
        map.put(BubblingSort.class.getSimpleName(), new BubblingSort());
        map.put(SelectionSort.class.getSimpleName(), new SelectionSort());
        map.put(InsertionSort.class.getSimpleName(), new InsertionSort());
        map.put(QuickSort.class.getSimpleName(), new QuickSort());
    }

    public static Collection<ISort> getAll() {
        return map.values();
    }

    public static ISort get(String name) {
        return map.get(name);
    }


}
